<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .view-box {
            width: 400px;
            height: 300px;
            overflow: hidden;
        }

        .image-box {
            display: flex;
            width: 1600px;
            list-style: none;
        }

        .image-box>li {
            width: 400px;
            height: 300px;
            background-size: cover;
            background-repeat: no-repeat;
        }

        .image-box>li:nth-child(1) {
            background-image: url("../../../../image/01.jpg");
        }

        .image-box>li:nth-child(2) {
            background-image: url("../../../../image/02.jpg");
        }


        .image-box>li:nth-child(3) {
            background-image: url("../../../../image/03.jpg");
        }


        .image-box>li:nth-child(4) {
            background-image: url("../../../../image/04.jpg");
        }
    </style>
</head>

<body>
    <main id="app">
        <figure class="view-box">
            <ul class="image-box" :style="'transform: translate(' + transform + 'px);'">
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </figure>
    </main>
</body>
<script src="../../vue.js"></script>
<script>

    let vue = new Vue({
        el: "#app",
        data: {
            transform: 0
        }
    })

    let i = -2;

    setInterval(() => {
        let value = vue.transform;
        console.log("value = ",value);
        if (value <= -1200) {
            i = 2;
        } else if (value >= 0) {
            i = -2; 
        }
        value += i;
        vue.transform = value;
    },1)
 </script>

</html>